
<div class="container">
    
    <?php $att = array('class' => 'form-horizontal', 'role' => 'form', 'id' => 'postForm'); echo form_open('', $att);?>
    <div class="col-md-6">
        <div class="row">
            <div class="col-md-12">
                
              <div class="panel">
                
                <div class="panel-heading">
                  <div class="panel-title"> <img src="<?php echo $baseurl.'public/theme/default/img/add.png'?>" alt="user avatar" width="28" height="28" /></span> Thêm thuyền viên </div>
                </div>
                <div class="panel-body">
                    <?php if(isset($result) || validation_errors()):?>
                    <div class="alert alert-danger" id="show-msg">
                        <div class="btn-close"><button type="button" id="close-msg" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>
                             <?php if(isset($result)){echo $result;}?>
                            <?php echo validation_errors(); ?>
                    </div>
                    <?php endif;?>
                    <div class="form-group">
                      <label for="inputStandard" class="col-lg-2 control-label">Full Name</label>
                      <div class="col-lg-10">
                        <input type="text" id="nameCrew" name="nameCrew" class="form-control" value="" placeholder="Full Name">
                      </div>
                    </div>
                    <div class="form-group">
                      <label for="inputPassword" class="col-lg-2 control-label">Rank</label>
                      <div class="col-lg-10">
                        <input type="text" class="form-control" id="rank" name="rank" value="" placeholder="rank">
                      </div>
                    </div>
                    
                    <div class="form-group">
                      <label for="inputPassword" class="col-lg-2 control-label">Date of birth</label>
                      <div class="col-lg-10">
                        <input type="text" class="form-control" id="date-of-birth" name="date-of-birth" value="" placeholder="Date of birth">
                      </div>
                    </div>
                    
                    <div class="form-group">
                      <label for="inputPassword" class="col-lg-2 control-label">Sex</label>
                      <div class="col-lg-10">
                        <select class="form-control" id="sex" name="sex">
                            <?php echo $sex_option ?>
                        </select>
                      </div>
                    </div>
                    
                    <div class="form-group">
                      <label for="inputPassword" class="col-lg-2 control-label">Address</label>
                      <div class="col-lg-10">
                        <input type="text" class="form-control" id="adress" name="address" value="" placeholder="Address">
                      </div>
                    </div>
                    <div class="form-group">
                      <label for="inputPassword" class="col-lg-2 control-label">Email</label>
                      <div class="col-lg-10">
                        <input type="text" class="form-control" id="email" name="email" value="" placeholder="Email">
                      </div>
                    </div>
                    <div class="form-group">
                      <label for="inputPassword" class="col-lg-2 control-label">Mobile</label>
                      <div class="col-lg-10">
                        <input type="text" class="form-control" id="mobile" name="mobile" value="" placeholder="Mobile">
                      </div>
                    </div>
                    
                    <div class="form-group">
                      <label for="inputPassword" class="col-lg-2 control-label">Signed on date</label>
                      <div class="col-lg-10">
                        <input type="text" class="form-control" id="signed-on-date" name="signed-on-date" value="" placeholder="Signed on date">
                      </div>
                    </div>
                    
                    <div class="form-group">
                      <label for="inputPassword" class="col-lg-2 control-label">Seaman pass no</label>
                      <div class="col-lg-10">
                        <input type="text" class="form-control" id="seaman-pass-no" name="seaman-pass-no" value="" placeholder="Seaman pass no">
                      </div>
                    </div>
                    <div class="form-group">
                      <label for="inputPassword" class="col-lg-2 control-label">Seaman pass exp date</label>
                      <div class="col-lg-10">
                        <input type="text" class="form-control" id="seaman-pass-exp-date" name="seaman-pass-exp-date" value="" placeholder="Seaman pass exp date">
                      </div>
                    </div>
                    
                    <div class="form-group">
                      <label for="inputPassword" class="col-lg-2 control-label">Intl pass no</label>
                      <div class="col-lg-10">
                        <input type="text" class="form-control" id="intl-pass-no" name="intl-pass-no" value="" placeholder="Intl pass no">
                      </div>
                    </div>
                    <div class="form-group">
                      <label for="inputPassword" class="col-lg-2 control-label">Intl pass exp date</label>
                      <div class="col-lg-10">
                        <input type="text" class="form-control" id="intl-pass-exp-date" name="intl-pass-exp-date" value="" placeholder="Intl pass exp date">
                      </div>
                    </div>
                    
                    <div class="form-group">
                      <label for="inputPassword" class="col-lg-2 control-label">Note about crew</label>
                      <div class="col-lg-10">
                        <div id="pop_upload" style="position: absolute;width: 100%;height: 100%;z-index: 999;display: none">
                            <p style="text-align: center;width: 100%;height: 100%;background: #CCC;padding-top: 25%;color: #990000;font-size: 25px;">Đang upload ảnh ...</p>
                        </div>
                        <textarea class="form-control text-field-alt margin-bottom-lg" rows="2" id="note-crew" name="note-crew" placeholder="Note about crew"></textarea>
                      </div>
                    </div>
                </div>
              </div>
            </div>
        </div>
    </div>
    <div class="col-md-3-3">
        <div class="row">
            <div class="col-md-12">
                 <div class="panel">
                    <div class="panel-heading">
                      <div class="panel-title"><img src="<?php echo $baseurl.'public/theme/default/img/arrow_right.png'?>" alt="user avatar" width="28" height="28" /> Hành động</div>
                    </div>
                    <div class="panel-body">
                      <div class="form-group">
                          <div class="col-lg-10" style="width: 100%;">
                           <label for="img" style="cursor: pointer;width: 100% !important;">
                            <div class="console-btn">
                            
                              <div class="console-icon divider-right"> <span class="glyphicon glyphicon-open"></span> </div>
                              <div class="console-text">
                               
                                <div class="console-subtitle">
                                Ảnh đại diện
                                </div>
                                <div class="console-title">
                                <input type="file" name="img" id="img" value="" onchange="convertimg()" style="display: none;" />
                                <input type="text" name="img_hidden" id="img_hidden" value="" style="display: none;" />
                                
                                <label for="img" style="position: absolute;cursor: pointer">Chọn ảnh</label>
                                </div>
                              </div>
                              
                              <div class="clearfix"></div>
                              <img id="img_show" src="<?php echo $baseurl.'public/upload/images/default.png'?>" style="width: 100%;" />
                            </div>
                            </label>
                            
                            <button type="submit" class="btn btn-info btn-gradient btn-sm">Lưu lại</button>
                            <button type="button" class="btn btn-default btn-gradient btn-sm" onclick="window.location='<?php echo $baseurl.'crew.html'?>'">Hủy bỏ</button>
                          </div>
                        </div>
                    </div>  
                 </div>
            </div>
        </div>
    </div>
    </form>
</div>
<script>
function convertimg()
{
    var chose = chose;
    var filesSelected = document.getElementById("img").files;
    if (filesSelected.length > 0)
    {
        var fileToLoad = filesSelected[0];

        var fileReader = new FileReader();

        fileReader.onload = function(fileLoadedEvent) 
        {
            var textAreaFileContents = document.getElementById
            (
                "textAreaFileContents"
                );
            $("#img_hidden").attr('value', fileLoadedEvent.target.result);
            $("#img_show").attr('src', fileLoadedEvent.target.result);
            
            
        };

        fileReader.readAsDataURL(fileToLoad);
    }
}

</script>